using octalforty.Brushie.Web.XmlRpc;

namespace octalforty.Syndication.Blogging.MetaWeblog
{
    /// <summary>
    /// Represents a media object which can be posted using <see cref="IMetaWeblogService.NewMediaObject"/>.
    /// </summary>
    [XmlRpcStructure()]
    public class MediaObject
    {
        #region Private Member Variables
        private string name;
        private string mimeType;
        private byte[] content;
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets or sets a string which contains the name of the <see cref="MediaObject"/>.
        /// </summary>
        [XmlRpcMember("name")]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        /// <summary>
        /// Gets or sets a string which contains the MIME type of the <see cref="MediaObject"/>.
        /// </summary>
        [XmlRpcMember("type")]
        public string MimeType
        {
            get { return mimeType; }
            set { mimeType = value; }
        }

        /// <summary>
        /// Gets or sets a string which contains the actual content of the <see cref="MediaObject"/>.
        /// </summary>
        [XmlRpcMember("bits")]
        public byte[] Content
        {
            get { return content; }
            set { content = value; }
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of <see cref="MediaObject"/> class.
        /// </summary>
        public MediaObject()
        {
        }

        /// <summary>
        /// Initializes a new instance of <see cref="MediaObject"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="mimeType"></param>
        /// <param name="content"></param>
        public MediaObject(string name, string mimeType, byte[] content)
        {
            this.name = name;
            this.mimeType = mimeType;
            this.content = content;
        }
    }
}
